﻿using System;
using umbraco.cms.businesslogic.datatype;
using umbraco.interfaces;

namespace netaddICTs.Umb.ProtectedMedia.Datatypes.ProtectedUploadField {

    public class DataType : AbstractDataEditor {
    
        private IData _baseData;
        private IDataEditor _editor;
        private IDataPrevalue _prevalueEditor;

        public override IDataEditor DataEditor {
            get {
                if (_editor == null)
                    _editor = new DataEditor(Data);
                return _editor;
            }
        }

        public override IData Data {
            get {
                if (_baseData == null)
                    _baseData = new DefaultData(this);
                return _baseData;
            }
        }

        public override string DataTypeName {
            get { return "Protected Upload Field"; }
        }

        public override Guid Id {
            get { return new Guid("6E8C86F8-2CA7-4e11-9AFB-D400C730968C"); }
        }

        public override IDataPrevalue PrevalueEditor {
            get {
                if (_prevalueEditor == null)
                    _prevalueEditor = new PrevalueEditor(this);
                return _prevalueEditor;
            }
        }
    }
}